package June;

public class Test_9_2 {
    public static void main(String[] args) {
//        int sum = 0;
//        for (int i = 1; i <= 10000; i++) {
//            sum += i;
//        }
//        System.out.println(sum);
        person p1 = new person();
        p1.speak();
        p1.cal01();
        p1.cal02(10);
        p1.cal02(100);
        int sum = p1.getsum(10, 20);
        System.out.println(sum);

    }
}

class person {
    public void speak() {
        System.out.println("我是一个人");
    }

    public void cal01() {
        int res = 0;
        for (int i = 0; i <= 100; i++) {
            res += i;
        }
        System.out.println(res);
    }

    public void cal02(int num) {
        int res = 0;
        for (int i = 0; i <= num; i++) {
            res += i;
        }
        System.out.println(res);
    }

    public int getsum(int num1, int num2) {
        int res = num1 + num2;
        return res;
    }

}